var form;
var laydate;
layui.use(['form','laydate'],function(){
    form = layui.form;
    laydate = layui.laydate;

    //开始时间
    laydate.render({
        elem: '#startDate',
        type: 'datetime',
        trigger:'click',
        done:function (value,date) {
            $("#startDate").val(value);
        }
    });

    //结束时间
    laydate.render({
        elem: '#endDate',
        type: 'datetime',
        trigger:'click',
        done:function (value,date) {
            $("#endDate").val(value);
        }
    });

});

//课程分类下拉菜单
$.ajax({
    url: "/SyOperationController/selProductCategorySelect",
    type: "get",
    dataType: "json",
    success: function (data) {
        for(var a=0;a<data.obj.length;a++){
            $("#category_id").append("<option value='"+data.obj[a].category_id+"'>"+data.obj[a].categroy_name+"</option>");
        }
    }
})

//确定查询
function selProduct() {
    var couponName=$("input[name='couponName']").val();
    var mode=$("#mode option:selected").val();
    var startDate=$("input[name='startDate']").val();
    var endDate=$("input[name='endDate']").val()
    var online=$("#online option:selected").val();

    parent.$("#couponName").val(couponName);
    parent.$("#mode option:selected").val(mode);
    parent.$("#startDate").val(startDate);
    parent.$("#endDate").val(endDate);
    parent.$("#online option:selected").val(online);


    parent.selCoupon();

    //点击检索之后清空父子的输入框
    $("input").val("");
    $(this).find("option:selected").removeAttr("selected")
    parent.$("input").val("");
    parent.$(this).find("option:selected").removeAttr("selected");

    var layer_1=parent.layer_1;
    layer_1.close(layer_1.index);
};


//重置
function Reset(){
    $("input").val("");
    $(this).find("option:selected").removeAttr("selected");
}